import {request} from "./request";

// 添加购物车
export function addCart(data) {
    return request({
        url: `/api/carts`,
        method: 'post',
        data
    })
}

// 购物车列表
export function getCart(params = {}) {
    return request({
        url: `/api/carts`,
        params
    })
}

// 购物车数量改变 data = {num:1}
export function modifyCart(id, data) {
    return request({
        url: `/api/carts/${id}`,
        method: 'put',
        data
    })
}

// 移出购物车
export function deleteCartItem(id) {
    return request({
        url: `/api/carts/${id}`,
        method: 'delete',
    })
}

// 购物车改变选中
export function checkedCard(data) {
    return request({
        url: `/api/carts/checked`,
        method: 'patch',
        data
    })
}